using System;
using Newtonsoft.Json;

namespace ConsoleAppDemoOne
{
    public class Solution {
        public int CountBattleships(char[][] board) {
            int row = board.Length;
            int col = board[0].Length;
            int ans = 0;
            for (int i = 0; i < row; ++i) {
                for (int j = 0; j < col; ++j) {
                    if (board[i][j] == 'X') {
                        board[i][j] = '.';
                        for (int k = j + 1; k < col && board[i][k] == 'X'; ++k) {
                            board[i][k] = '.';
                        }                    
                        for (int k = i + 1; k < row && board[k][j] == 'X'; ++k) {
                            board[k][j] = '.';
                        }
                        ans++;
                    }
                }
            }
            return ans;
        }
        
        public static void Main(string[] args)
        {
            var boardInput = Console.ReadLine();
            var board = JsonConvert.DeserializeObject<char[][]>(boardInput ?? String.Empty);
            Console.WriteLine(new Solution().CountBattleships(board));
        }
        
    }
    
}